{-# OPTIONS -Wall #-}

module Demo01 where


import P5Hs.CLI
import P5Hs.Language.Syntax


{-
$ ./processing-java.exe --run --sketch=d:/coding/art_sound/processing/reactive1b --force --output=d:/temp/processing1

-}

main :: IO ()
main = do
  createSketch setup src
  _ <- runSketch setup
  return ()


setup :: CLISetup
setup = CLISetup 
    { path_to_processing_java   = "G:\\programs\\processing-2.0.1\\processing-java.exe"
    , sketch_name               = "test_sketch"
    , output_root               = "d:\\temp"
    }

src :: ProgramText
src = unlines $
  [ "float a = 100;"
  , ""
  , "void setup()"
  , "{"
  , "  size(640, 200);"
  , "  stroke(252,9,45);"
  , "}"
  , ""
  , "void draw()"
  , "{"
  , "  background(174,221,60);"
  , "  a = a - 0.5;"
  , "  if (a < 0) {"
  , "    a = height;"
  , "  }"
  , "  line(0, a, width, a);"
  , "}"
  ]

-- With default colorMode:
-- background/1 grayscale
-- background/3 RGB

-- colorMode can also set ranges to integer (0 .. 255) or 
-- float (0 .. 1.0)